﻿<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>中州大学教务网络管理系统</title>
	<link rel="stylesheet" href="/Schedule/css/action_style.css" type="text/css"/>
	<script type="text/javascript">
			var data =[{img:1},{img:2},{img:3},{img:4}];
			var g = function(id){
				if(id.substr(0,1)=='.'){
					return document.getElementsByClassName(id.substr(1));
				}
				return document.getElementById(id);
			}

			function addShow(){
				var tpl_main = g('show_main').innerHTML
									.replace(/^\s*/,'')
									.replace(/\s*$/,'');
				var tpl_ctrl = g('show_ctrl').innerHTML
									.replace(/^\s*/,'')
								 	.replace(/\s*$/,'');	
													  
				var out_main=[];
				var out_ctrl=[];

				for(i in data){
					var _html_main=tpl_main.replace(/{{index}}/g,data[i].img);
					var _html_ctrl=tpl_ctrl.replace(/{{index}}/g,data[i].img);

					out_main.push(_html_main);
					out_ctrl.push(_html_ctrl);
				}		
				g('show_main').innerHTML = out_main.join('');
				g('show_ctrl').innerHTML = out_ctrl.join('');							  							
			}

			function switchShow(n){
				var main = g('main_'+n);
				var ctrl = g('ctrl_'+n);

				var clear_main = g(".main-i");
				var clear_ctrl = g(".ctrl-i");
				for(i=0;i<clear_ctrl.length;i++){
					clear_main[i].className = clear_main[i].className.replace(" main-i_activity","");
					clear_ctrl[i].className = clear_ctrl[i].className.replace(" ctrl-i_activity","");
				}

				main.className += ' main-i_activity';
				ctrl.className += ' ctrl-i_activity';


			}

			window.onload = function(){
				addShow();
				switchShow(1);
			}
		</script>
</head>

<body>
	<div class="right" name="main">
		<div class="main" id="show_main">
			<div class="main-i" id="main_{{index}}">
				<img src="/Schedule/imgs/{{index}}.jpg" />
			</div>
		</div>

		<div class="ctrl" id="show_ctrl">
			<a class="ctrl-i" id="ctrl_{{index}}" href="javascript:switchShow({{index}});"><img src="/Schedule/imgs/{{index}}.jpg" /></a>
		</div>
	</div>
</body>
</html>
